home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1987 June
/
Ahoy_Magazine_87-06_1987_Double_L.d64
/
64 Switch Bounce
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
1KB
|
53 lines
0 rem << rr42-3 >>
100 rem=================================
110 print"[147] switch bounce"
120 rem rupert report #42
130 rem for c128/c64
140 rem use 40-column display
150 print"plug joystick into port 2"
160 print"press joystick button and see"
170 print"a display of switch bounce."
180 rem to exit, hold run/stop then
190 rem press joystick button
200 rem=================================
220 m=5072
230 read b$
240 if b$="xx" then 340
250 rem --------------------------------
260 rem for c64 change line 290
270 rem to gosub 500
280 rem --------------------------------
290 gosub 500
300 ck=ck+b :rem checksum
310 poke m,b
320 m=m+1
330 goto 230
340 if ck<>6226 then print"data error" : stop
350 print"use 40-column screen. ";
360 print"put joystick into port 2. ";
370 for l=3 to 20 : print : next
380 print"press joystick button"
390 sys 5072
400 for n=1 to 38 :print" ";:next :print"[145]"
410 print"or hold run/stop & press button to exit[145]"
420 goto 390
430 end
500 rem --lines 500-600 for c64 only----
510 rem convert hex to decimal
520 ms$=left$(b$,1)
530 ls$=right$(b$,1)
540 ms=val(ms$)
550 if ms$>="a" then ms=asc(ms$)-55
560 ls=val(ls$)
570 if ls$>="a" then ls=asc(ls$)-55
580 b=ms*16+ls
590 return
600 rem --------------------------------
5072 data a9, 00, 85, fb, a9, 04, 85, fc
5080 data a0, 00, a2, 07, a9, 10, 2c, 00
5088 data dc, d0, fb, a9, 10, 2c, 00, dc
5096 data f0, 04, a9, 31, d0, 02, a9, 30
5104 data 91, fb, c8, d0, ee, e6, fc, e4
5112 data fc, d0, e8, 60
5116 data xx